using System.ComponentModel.DataAnnotations;

namespace Gateway.IApplication.User.Input;
/// <summary>
/// 创建用户
/// </summary>
public class CreateUserInput : IValidatableObject
{
    /// <summary>
    /// 用户头像
    /// </summary>
    public string UserAvatar { get; set; }

    /// <summary>
    /// 姓名
    /// </summary>
    public string UserName { get; set; }

    /// <summary>
    /// 账号
    /// </summary>
    public string Account { get; set; }

    /// <summary>
    /// 编号
    /// </summary>
    public string UserNo { get; set; }

    /// <summary>
    /// 所属角色标识
    /// </summary>
    public List<string> RoleIds { get; set; }

    /// <summary>
    /// 部门标识
    /// </summary>
    public string DepartmentId { get; set; }

    /// <summary>
    /// 密码
    /// </summary>
    public string Password { get; set; }
    /// <summary>
    /// 
    /// </summary>
    /// <param name="validationContext"></param>
    /// <returns></returns>
    public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
    {
        if (RoleIds.Count <= 0)
            yield return new ValidationResult("请至少选择一个角色");
    }
}